//
//  ViewController.swift
//  KKViewController_Animation
//
//  Created by liaozhenming on 2016/12/15.
//  Copyright © 2016年 liaozhenming. All rights reserved.
//

import UIKit

class AViewController: UIViewController, UINavigationControllerDelegate, UIViewControllerTransitioningDelegate {

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        self.navigationController?.delegate = self
        self.transitioningDelegate = self
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    
    @IBAction func action_push(_ sender: Any) {
        
        let storyboard = UIStoryboard(name:"Main",bundle:nil)
        let BViewController = storyboard.instantiateViewController(withIdentifier: "BViewController")
        self.navigationController?.pushViewController(BViewController, animated: true)
    }
    
    
    @IBAction func action_Present(_ sender: Any) {
        
        let storyboard = UIStoryboard(name:"Main",bundle:nil)
        let CViewController = storyboard.instantiateViewController(withIdentifier: "CViewController")
//        self.present(CViewController, animated: true, completion: nil
//        )
        
//        self.kk_popover(CViewController)
        self.kk_popover(CViewController, displayScale: 1.0)
    }
    
    //
    func navigationController(_ navigationController: UINavigationController, animationControllerFor operation: UINavigationControllerOperation, from fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {
        
        return KKViewControllerAnimation()
    }
    
    //
    
//    func interactionControllerForPresentation(using animator: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? {
//        
//    }
    
}

